package com.dynamic.mybatis.core.utils;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class IOUtils {
    public static void transform(InputStream is, OutputStream os) {
        if (is == null || os == null) {
            return;
        }
        int i;
        try {
            while ((i = is.read()) != -1) {
                os.write(i);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                is.close();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            try {
                os.close();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }
}
